package com.example.yin.controller;

import com.example.yin.common.R;

import com.example.yin.service.VipService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 定义 VipController 控制器，用于处理VIP会员相关的HTTP请求
 */

@RestController
@RequestMapping("/vip")
public class VipController {
    @Autowired
    private VipService vipService;
    //根据用户id获取VIP会员信息
    @GetMapping("/getid")
    public R vipOfid(@RequestParam int userid){
        return vipService.vipOfId(userid);
    }
    //将用户添加为VIP会员
    @GetMapping("/add")
    public R addVip(@RequestParam int userid){
        return vipService.addVip(userid);
    }
    //将用户取消VIP会员资格
    @GetMapping("/delete")
    public R deleteIfVip(@RequestParam int userid){
        return vipService.delete(userid);
    }
}
